package com.eboss2.sbs.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.ScrollView;

import com.eboss2.sbs.R;
import com.eboss2.sbs.activity.base.BaseActivity;
import com.eboss2.sbs.http.API;
import com.eboss2.sbs.http.HttpCallback;
import com.eboss2.sbs.model.EbossInfoEntity;
import com.google.gson.reflect.TypeToken;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
import com.handmark.pulltorefresh.library.PullToRefreshScrollView;
import com.mytools.tool.activityManager.MyActivityManager;
import com.mytools.tool.utils.StringUtil;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.HashMap;
import java.util.Map;

public class MyEditShopManageActivity extends BaseActivity implements View.OnClickListener{

	
	private ImageView img_merchant_icon;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		mContext = this;
		setContentView(R.layout.activity_edit_shop_manage);
		MyActivityManager.getInstance().addActivity(this);
		initView();
	}
	
	private void initView(){
		showView(R.id.titleback_btn_back, true);
		findViewById(R.id.titleback_btn_back).setOnClickListener(this);
		setTvText(R.id.tv_title, "修改门店经营信息");
		showView(R.id.next_sure, true);
		setTvText(R.id.next_sure, "保存");



	}

	
	private void getdata(){
		Map<String, Object> params = new HashMap<String, Object>();
//		params.put("sid", mApp.getLoginEntity().getSid());
		API.http_post(this, API.MY_EBOSS_INFO, params, new HttpCallback<EbossInfoEntity>(this) {
			@Override
			public void onSuccess(int statusCode, EbossInfoEntity data) {
				if(data!=null){
					setTvText(R.id.tv_merchant_name, data.getMerchantName());
					String icon_url = data.getMerchantIconUrl();
					if(!StringUtil.isNull(icon_url)){ImageLoader.getInstance().displayImage(icon_url, img_merchant_icon);}
					setTvText(R.id.tv_superiors, data.getSuperiors());
//					setTvText(R.id.tv_merchant_address, data.getAddress());
					setTvText(R.id.tv_company_name, data.getCompanyName());
					setTvText(R.id.tv_company_address, data.getCompanyAddress());
//					setTvText(R.id.tv_company_license, data.getLicenseNo());
//					setTvText(R.id.tv_charge_name, data.getChargeName());
					setTvText(R.id.tv_contact_phone, data.getContactPhone());
//					setTvText(R.id.tv_contact_email, data.getContactEmail());
					setTvText(R.id.tv_account_name, data.getAccountName());
					setTvText(R.id.tv_account_bank, data.getAccountBank());
					setTvText(R.id.tv_account_no, data.getAccountNo());
				}
			}

			@Override
			public void onFailure(int statusCode, String message) {
				super.onFailure(statusCode, message);
			}
			
			@SuppressWarnings({ "unchecked", "rawtypes" })
			@Override
			public TypeToken getTypeToken() {
				return new TypeToken<EbossInfoEntity>() {
				};
			}
		});
	}
	
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
			case R.id.titleback_btn_back:
				finish();
				break;
			default:break;
		}
	}
	
}
